package com.cssw.fyzb.job.executor.service.video;

import com.cssw.fyzb.core.dao.user.UserDao;
import com.cssw.fyzb.core.dao.video.UserVideoDao;
import com.cssw.fyzb.core.eao.video.VideoEao;
import com.cssw.fyzb.core.model.dodb.CmfUserVideo;
import com.cssw.fyzb.core.model.dodb.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Feng Chen
 */
@Service
public class UserVideoServiceImpl implements UserVideoService {

    @Autowired
    private UserVideoDao userVideoDao;

    @Autowired
    private UserDao userDao;

    @Autowired
    private VideoEao videoEao;

    @Override
    public List<CmfUserVideo> listWaitAuditVideo(int batch) {
        return userVideoDao.listByAudit(1, batch).getList();
    }

    @Override
    public void auditVideo(Long id, String videoId, Integer status) {

        // 需改数据库
        userVideoDao.audit(id, videoId, status);

//        CmfUserVideo video = userVideoDao.findById(videoId);
//        User user = userDao.getById(video.getUserId());
//
//        // 审核通过时, 创建索引
//        videoEao.save(
//                user.getUserId(), user.getNickName(), user.getAvatar(),
//                videoId, video.getTitle(), video.getHref(), video.getThum(), video.getCity(),
//                video.getLat(), video.getLng(), video.getCreateTime()
//        );

    }

}
